# encoding:utf-8

from PIL import ImageGrab

class imgsb:
    def saveimg(self, pathnames='1.png'):
        img = ImageGrab.grabclipboard()
        obj = dir(img)
        pathname = pathnames
        if 'save' in obj:
            img.save(pathname)
            return {'state': 1, 'message': '已经存入图片'}
        else:
            return {'state': 0, 'message': '您不是通过截图软件直接过去的图片'}

if __name__ == '__main__':
    orj = imgsb()
    orj.saveimg()